plugins {
	id 'war'
}

group = 'com.structurizr'

sourceCompatibility = '17'
targetCompatibility = '17'

repositories {
	mavenCentral()
//	mavenLocal()
	maven {
		url "https://build.shibboleth.net/maven/releases/"
	}
}

testing {
	suites {
		test {
			useJUnitJupiter()
		}

		integrationTest(JvmTestSuite) {
			dependencies {
				implementation project()
			}

			targets {
				all {
					testTask.configure {
						shouldRunAfter(test)
					}
				}
			}
		}
	}
}

tasks.named('check') {
	dependsOn(testing.suites.integrationTest)
}

dependencies {

	implementation project(':structurizr-onpremises-plugin')

	implementation 'com.structurizr:structurizr-dsl:2.0.0'
	implementation 'com.structurizr:structurizr-inspection:2.0.0'
	implementation 'com.structurizr:structurizr-autolayout:2.0.0'

	compileOnly 'jakarta.servlet:jakarta.servlet-api:6.0.0'
	implementation 'jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:3.0.0'
	implementation 'org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.1'

	implementation 'javax.annotation:javax.annotation-api:1.3.2'

	implementation 'org.springframework:spring-webmvc:6.1.4'
	implementation 'org.springframework.security:spring-security-web:6.2.2'
	implementation 'org.springframework.security:spring-security-config:6.2.2'
	implementation 'org.springframework.security:spring-security-ldap:6.2.2'
	implementation 'org.springframework.security:spring-security-saml2-service-provider:6.2.2'
	implementation 'org.springframework.session:spring-session-data-redis:3.2.0'
	implementation 'redis.clients:jedis:5.1.0'

	implementation 'org.apache.lucene:lucene-core:9.8.0'
	implementation 'org.apache.lucene:lucene-queryparser:9.8.0'

	implementation 'org.apache.logging.log4j:log4j-api:2.23.0'
	implementation 'org.apache.logging.log4j:log4j-core:2.23.0'
	implementation 'org.apache.logging.log4j:log4j-jcl:2.23.0'
	implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.23.0'

	implementation 'org.elasticsearch.client:elasticsearch-rest-client:7.9.0'
	implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.1'
	implementation 'org.apache.httpcomponents:httpasyncclient:4.1.5'

	implementation 'com.amazonaws:aws-java-sdk-s3:1.12.663'
	implementation 'com.amazonaws:aws-java-sdk-sts:1.12.663'

	implementation 'javax.cache:cache-api:1.1.1'
	implementation 'org.ehcache:ehcache:3.10.8'
	implementation 'org.redisson:redisson:3.26.1'

	testImplementation 'org.testcontainers:elasticsearch:1.19.5'
}

tasks.withType(JavaCompile).configureEach {
	options.compilerArgs.add("-parameters")
}

war {
	duplicatesStrategy 'exclude'

	webInf {
		from('src/main/java') {
			include '*.xml'
			into('classes')
		}
	}
}

sourceSets.main.resources {
	srcDirs = ['src/main/java','src/main/resources']
	include '**/*.xml'
	include 'log4j2.properties'
	include 'build.properties'
}

task getDependencies(type: Copy) {
	from configurations.default
	into 'build/dependencies'
}

task explodedWar(type: Sync) {
	into "${buildDir}/exploded"
	with war
}

configurations {
	integrationTestImplementation.extendsFrom testImplementation
	integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
}

configurations.implementation {
	exclude group: 'org.apache.xmlgraphics'
}